// Copyright (c) Microsoft Corporation. All rights reserved.

using System;
using System.IO;
using System.Collections;

namespace Microsoft.Tools.CodeRunner
{
	/// <summary>
	/// Search scope in which to look for files.
	/// </summary>
	public enum SearchScope
	{
		/// <summary>
		/// Search only the directory specified in the file specification
		/// </summary>
		DirectoryOnly,
		/// <summary>
		/// Search the directory in the file specification and all children recursively using a breadth
        /// first algorithm.
		/// </summary>
		RecurseSubDirectoriesBreadthFirst,
		/// <summary>
		/// Search the directory in the file specification and all direct parent directories
		/// </summary>
		RecurseParentDirectories,
		/// <summary>
		/// Search the directory in the file specification and all children recursively using a depth
        /// first algorithm.
		/// </summary>
		RecurseSubDirectoriesDepthFirst,
	}

	/// <summary>
	/// Extensions to the <see cref="Directory"/> class.
	/// </summary>
	public sealed class DirectoryUtility
	{
		/// <summary>
		/// See <see cref="DirectoryInfoUtility.GetFiles(string, SearchScope)"/>.
		/// </summary>
		/// <param name="fileSpec"></param>
		/// <param name="scope"></param>
		/// <returns></returns>
		public static FileInfo[] GetFiles(string fileSpec, SearchScope scope)
		{
			return DirectoryInfoUtility.GetFiles(fileSpec, scope);
		}
		
		/// <summary>
		/// See <see cref="DirectoryInfoUtility.GetDirectories(string, SearchScope)"/>
		/// </summary>
		/// <param name="dirSpec"></param>
		/// <param name="scope"></param>
		/// <returns></returns>
		public static DirectoryInfo[] GetDirectories(string dirSpec, SearchScope scope)
		{
			return DirectoryInfoUtility.GetDirectories(dirSpec, scope);
		}
	}
}
